package com.atguigu.vod.Utils.aliyunVodUtils;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthRequest;
import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthResponse;

public class GetPlayAuthUtils {

    //根据视频id获取视频播放凭证
    public static String  getPlayAuth(String id) throws Exception{
        //根据视频id获取视频播放凭证
        //创建一个初始化对象
        DefaultAcsClient defaultAcsClient = InitObject.initVodClient("LTAI5tSocqfgccE716baKnWE", "LXGmKwTXsvB2b56lxWkC6YSCIRMGj9");

        //创建视频凭证的request 和response对象
        GetVideoPlayAuthRequest request = new GetVideoPlayAuthRequest();


        //向request设置视频id
        request.setVideoId(id);

        GetVideoPlayAuthResponse response = defaultAcsClient.getAcsResponse(request);
        return response.getPlayAuth();
    }
}
